import pandas as pd
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt

# 创建测试数据
df = pd.DataFrame({'num': [0.1, 5, 7, 8, 6, 5.5, 6.5, 7.5]})

# 画箱线图
print('平均数：%f\n1/4位数：%f\n中位数：%f\n3/4位数：%f' %
      (df.mean(), df.quantile(0.25), df.quantile(0.5), df.quantile(0.75)))

sns.boxplot(y=df.num)

# 查询异常值索引
num_outliers = df.num.idxmin()

# 根据索引删除异常值
df.drop(df.index[num_outliers], inplace=True)


